#include<bits/stdc++.h>
using namespace std;
struct node{
	int type,num,position,whole;
}x[200005];
int n,a[200005],v[200005],last=-1,cnt,getted;
int main(){
	freopen("fruit.in","r",stdin);
	freopen("fruit.out","w",stdout);
	x[0].num = -1, x[0].type = -1;
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%d",&a[i]);
		if(a[i]==x[cnt].type) x[cnt].num++;
		else{
			cnt++;
			x[cnt].position=i;
			x[cnt].type=a[i];
			x[cnt].num++;
		}
	}
	for(int i=1;i<=cnt;i++){
		x[i].whole=x[i].num;
	}
	while(getted<n){
		last=-1;
		for(int i=1;i<=cnt;i++){
			if(x[i].type==last) continue;
			if(x[i].num<=0) continue;
			printf("%d ",x[i].position+(x[i].whole-x[i].num));
			last=x[i].type;
			x[i].num--;
			getted++;
		}
		printf("\n");
//		cout<<getted<<endl;
	}
	
	return 0;
}

//fc fruit.out baoli.out
